package com.happy_hao.topbiz.api;

import com.happy_hao.topbiz.common.Result;
import com.happy_hao.topbiz.dto.userDto.CreateUserRequest;
import com.happy_hao.topbiz.dto.userDto.UpdateUserRequest;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "user",path = "/user")
public interface UserApi {
    @PostMapping("/user/create")
    public Result createUser(@RequestBody CreateUserRequest createUserRequest) ;

    @GetMapping("/user/readById")
    public Result readUserById(@RequestParam("id") Long id) ;

    @GetMapping("/user/readByIdentifier")
    public Result readUserByName(@RequestParam("identifier") String identifier) ;

    @RequestMapping("/user/update")
    public Result updateUser(@RequestBody UpdateUserRequest updateUserRequest) ;

    @DeleteMapping("/user/delete")
    public Result deleteUser(@RequestParam("id") Long id) ;

    @GetMapping("/administrator/getUserInfo")
    public Result getUserInfo(@RequestParam("username") String username) ;

    @GetMapping("/administrator/getAllUserSimpleInfo")
    public Result getAllUserSimpleInfo() ;

    @RequestMapping("/administrator/updateUserInfo")
    public Result updateUserInfo(@Valid @RequestBody UpdateUserRequest updateUserRequest) ;

    @PostMapping("/administrator/addNewGroup")
    public Result addNewGroup(@RequestParam("groupName") String groupName);

    @GetMapping("/administrator/getAllGroups")
    public Result getAllGroups() ;

    @PostMapping("/administrator/bindUserToGroup")
    public Result bindUserToGroup(@RequestParam("groupName") String groupName, @RequestParam("username") String username) ;

    @DeleteMapping("/administrator/kickUserFromGroup")
    public Result kickUserFromGroup(@RequestParam("groupName") String groupName,@RequestParam("username") String username) ;

    @GetMapping("/administrator/getGroupAllUsers")
    public Result getGroupAllUsers(@RequestParam("groupName") String groupName) ;

    @GetMapping("/administrator/getAllPermissions")
    public Result getAllPermissions() ;

    @PostMapping("/administrator/bindPermissionToGroup")
    public Result bindPermissionToGroup(@RequestParam("groupName") String groupName,@RequestParam("permissionName")  String permissionName) ;

    @DeleteMapping("/administrator/dropPermissionFromGroup")
    public Result dropPermissionFromGroup(@RequestParam("groupName") String groupName,@RequestParam("permissionName") String permissionName) ;
}